package com.sright.bcard.enterprise.biz.service;

import com.sright.bcard.common.service.share.dto.page.PageDTO;
import com.sright.bcard.common.service.share.dto.page.PageParamRequest;
import com.sright.bcard.enterprise.biz.manager.CompanyManager;
import com.sright.bcard.common.service.share.dto.enterprise.CompanyDTO;
import com.sright.bcard.enterprise.share.service.CompanyService;
import com.sright.common.response.SrightResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class CompanyServiceImpl implements CompanyService {

    @Autowired
    private CompanyManager companyManager;

    @Override
    public SrightResponse<PageDTO<CompanyDTO>> companyList(PageParamRequest pageParamRequest) {
        return SrightResponse.defaultSuccess(companyManager.companyList(pageParamRequest));
    }

    @Override
    public SrightResponse<Boolean> addCompany(CompanyDTO companyDTO) {
        return SrightResponse.defaultSuccess(companyManager.addCompany(companyDTO));
    }

    @Override
    public SrightResponse<Boolean> updateCompany(CompanyDTO companyDTO) {
        return SrightResponse.defaultSuccess(companyManager.updateCompany(companyDTO));
    }

    @Override
    public SrightResponse<Boolean> deleteCompany(List<Long> ids) {
        return SrightResponse.defaultSuccess(companyManager.deleteCompany(ids));
    }

    @Override
    public SrightResponse<List<CompanyDTO>> getList(Long enterpriseId) {
        return SrightResponse.defaultSuccess(companyManager.getList(enterpriseId));
    }
}
